<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('name')->nullable()->comment('用户名');            
            $table->string('avatar')->nullable()->comment('头像');
            $table->integer('sex')->default(1)->comment('1-男，2-女');
            $table->integer('notification_count')->unsigned()->default(0)->comment('通知数');
            $table->timestamp('last_actived_at')->nullable()->comment('最后登录时间');
            $table->string('phone')->nullable()->unique()->comment('手机号');
            $table->string('weixin_openid')->nullable()->comment('微信公众号openid');
            $table->string('weixin_unionid')->nullable()->comment('微信unionid');
            $table->string('weapp_openid')->nullable()->unique()->comment('微信小程序openid');
            $table->string('weixin_session_key')->nullable();
            $table->rememberToken()->comment('记住我');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
